package com.xiaozhen.driver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xiaozhen.common.core.domain.driver.ParseModbusAttribute;
import com.xiaozhen.driver.dao.ParseModbusAttributeDao;
import com.xiaozhen.driver.service.ParseModbusAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/11/17 10:24
 * @description:
 */
@Service
public class ParseModbusAttributeServiceImpl implements ParseModbusAttributeService {

    @Autowired
    private ParseModbusAttributeDao parseModbusAttributeDao;

    @Override
    public List<ParseModbusAttribute> selectAttributeList(Long driverId) {
        QueryWrapper<ParseModbusAttribute> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("driver_id", driverId);
        return parseModbusAttributeDao.selectList(queryWrapper);
    }

    @Override
    public int insertAttribute(ParseModbusAttribute parseAttribute) {
        return parseModbusAttributeDao.insert(parseAttribute);
    }

    @Override
    public int updateAttribute(ParseModbusAttribute parseAttribute) {
        return parseModbusAttributeDao.updateById(parseAttribute);
    }

    @Override
    public int deleteAttributeById(Long modbusId) {
        return parseModbusAttributeDao.deleteById(modbusId);
    }
}
